from rest_framework.views import APIView, Response
from meiduo_admin.serializers.loginSerializer import LoginSerializer


class LoginView(APIView):

    def post(self,request):
        data = request.data
        bs = LoginSerializer(data=data)
        bs.is_valid(raise_exception=True)

        return Response({
            "username":bs.validated_data["username"],
            "user_id":bs.validated_data["user_id"],
            "token":bs.validated_data["token"]
        })


